@import './themes.scss';
// 遍历主题map
@mixin themeify {
  @each $theme-name, $theme-map in $themes {
    //!global 把局部变量强升为全局变量
    $theme-map: $theme-map !global;
    //判断html的data-theme的属性值  #{}是sass的插值表达式
    //& sass嵌套里的父容器标识   @content是混合器插槽，像vue的slot
    // eslint-disable-next-line
    [data-theme=#{'' + $theme-name}] & {
      @content;
    }
  }
}

// 声明一个根据Key获取颜色的function
@function themed($key) {
  @return map-get($theme-map, $key);
}

// ===========================自定义样式===========================
// 获取背景颜色
@mixin background-color($color) {
  @include themeify {
    background-color: themed($color) !important;
  }
}

// 获取渐变背景颜色
@mixin bg-color-linear-gradient($direction, $shallowColor, $deepColor) {
  @include themeify {
    background: linear-gradient($direction, themed($shallowColor) 0%, themed($deepColor) 100%) !important;
  }
}

// 获取字体颜色
@mixin color($color) {
  @include themeify {
    color: themed($color) !important;
  }
}

// 获取边框颜色
@mixin border-color($color) {
  @include themeify {
    border-color: themed($color) !important;
  }
}